﻿using Order.Domain.ValueObject;
using System;
using System.Collections.Generic;
using System.Text;

namespace Order.Domain.Entity
{
    /// <summary>
    /// 订单明细
    /// 订单明细：Id，产品价格，产品数量，产品颜色，产品型号，产品Id
    /// </summary>
    public class OrderItem : BaseEntity
    {
        public OrderItem()
        {

        }

        public OrderItem(string orderId, decimal skuPrice, int skuQuantity, string skuId, string spuName)
        {
            Status = true;
            OrderId = orderId;
            SkuPrice = skuPrice;
            SkuQuantity = skuQuantity;
            SkuId = skuId;
            OrderProduct = new OrderProductVo() { SpuName = spuName };
        }

        public static OrderItem AddOrderItem(string orderId, decimal skuPrice, int skuQuantity, string skuId, string spuName)
        {
            return new OrderItem(orderId, skuPrice, skuQuantity, skuId, spuName);
        }

        public OrderItem SetOrderItem(decimal skuPrice, int skuQuantity, string skuId, string spuName) 
        {
            SkuPrice = skuPrice;
            SkuQuantity = skuQuantity;
            SkuId = skuId;
            OrderProduct = new OrderProductVo() { SpuName = spuName };
            return this;
        }

        /// <summary>
        /// 订单Id
        /// </summary>
        public string OrderId { get; private set; }

        /// <summary>
        /// sku价格
        /// </summary>
        public decimal SkuPrice { get; private set; }

        /// <summary>
        /// sku数量
        /// </summary>
        public int SkuQuantity { get; private set; }

        /// <summary>
        /// skuId
        /// </summary>
        public string SkuId { get; private set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public bool Status { get; private set; }

        /// <summary>
        /// 产品属性值对象
        /// </summary>
        public virtual OrderProductVo OrderProduct { get; set; }
       
    }
}
